using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Profile;
using System.Windows.Forms;
using Facebook.Components;

namespace ProfileWrapper
{
    public class ProfileWrapper
    {
        private CBuddyIdAssociation m_assoc;
        private FacebookService m_service;
        public ProfileWrapper()
        {
            m_service = new FacebookService();
            m_assoc = new CBuddyIdAssociation(m_service);
            m_service.Secret = "43aa4ec7ac3b3795db43734556ee794c";
            m_service.ApplicationKey = "6f542812b4a26376877e79db0ce7f4d9";
        }
        public bool showProfile(string screenName)
        {
            ProfileDlg dlg = new ProfileDlg(m_service,m_assoc);
            dlg.Text = screenName;
            dlg.m_sn = screenName;
            if (!m_assoc.ContainsKey(screenName))
            {
                AssociateDlg assocDlg = new AssociateDlg(m_service);
                DialogResult rst = assocDlg.ShowDialog(dlg);
                if (rst == DialogResult.OK) ((Dictionary<string, string>)m_assoc).Add(screenName, assocDlg.m_fbId);
            }
            dlg.Show();
            return true;
        }
    }
}
